﻿// Serotonin -- easy-to-use image filters application
// https://code.google.com/p/serotonin/
//
// Copyright © Frank Nagl, 2012-2013
// admin@franknagl.de
//
namespace Serotonin.Controls
{
    using System.Drawing;
    using System.Windows.Forms;

    /// <summary>
    /// Shows an image in a separate independent window.
    /// </summary>
    /// 
    /// <remarks> 
    /// <para>Sample usage:</para>
    /// <code>
    /// Bitmap image = new Bitmap("Cathedral.jpg");
    /// new SimpleImageViewer(image);
    /// </code>
    /// 
    /// <para><b>Example:</b></para>
    /// <img src="../../SimpleImageViewer.jpg" width="500" height="347" />
    /// </remarks>
    /// 
    public partial class SimpleImageViewer : Form
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleImageViewer"/> class.
        /// </summary>
        /// <param name="bitmap">The bitmap to show.</param>
        public SimpleImageViewer(Bitmap bitmap)
        {
            InitializeComponent();
            bitmap = new Bitmap(bitmap, ImagePanel.Width, ImagePanel.Height);
            ImagePanel.BackgroundImage = bitmap;
            Show();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleImageViewer"/> class.
        /// </summary>
        /// <param name="bitmap">The bitmap to show.</param>
        /// <param name="title">The title.</param>
        public SimpleImageViewer(Bitmap bitmap, string title)
            : this(bitmap)
        {
            Text = title;
        }
    }
}
